<body>
    <table>
        <tr><!--第一行-->
            <td>位置</td>
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>C</td>
            <td>6</td>
            <td>7</td>
            <td>8</td>
            <td>9</td>
        </tr>
        <tr><!--第2行-->
            <td>最大</td>
            <td>
                <select id="max1">
                <option value ="750">750</option>
                <option value ="50">50</option>
                <option value ="200">200</option>
                <option value ="500">500</option>
                <option value ="1000">1000</option>
            </select></td>
            <td><select id="max2">
                <option value ="750">750</option>
                <option value ="50">50</option>
                <option value ="200">200</option>
                <option value ="500">500</option>
                <option value ="1000">1000</option>
              </select></td></td>
              <td><select id="max3">
                <option value ="750">750</option>
                <option value ="50">50</option>
                <option value ="200">200</option>
                <option value ="500">500</option>
                <option value ="1000">1000</option>
              </select></td></td>
              <td><select id="max4">
                <option value ="1000">1000</option>
                <option value ="750">750</option>
                <option value ="50">50</option>
                <option value ="200">200</option>
                <option value ="500">500</option>
              </select></td></td>
              <td><select id="max5">
                <option value ="1000">1000</option>
                <option value ="750">750</option>
                <option value ="50">50</option>
                <option value ="200">200</option>
                <option value ="500">500</option>
              </select></td></td>
              <td><select id="max6">
                <option value ="1000">1000</option>
                <option value ="750">750</option>
                <option value ="50">50</option>
                <option value ="200">200</option>
                <option value ="500">500</option>
              </select></td></td>
              <td><select id="max7">
                <option value ="750">750</option>
                <option value ="50">50</option>
                <option value ="200">200</option>
                <option value ="500">500</option>
                <option value ="1000">1000</option>
              </select></td></td>
              <td><select id="max8">
                <option value ="750">750</option>
                <option value ="50">50</option>
                <option value ="200">200</option>
                <option value ="500">500</option>
                <option value ="1000">1000</option>
              </select></td></td>
              <td><select id="max9">
                <option value ="750">750</option>
                <option value ="50">50</option>
                <option value ="200">200</option>
                <option value ="500">500</option>
                <option value ="1000">1000</option>
              </select></td></td>
        </tr>
        <tr><!--第3行-->
            <td>当前</td>
            <td><input type="number" id="x1" value="0"></td>
            <td><input type="number" id="x2" value="0"></td>
            <td><input type="number" id="x3" value="0"></td>
            <td><input type="number" id="x4" value="1000"></td>
            <td><input type="number" id="x5" value="1000"></td>
            <td><input type="number" id="x6" value="1000"></td>
            <td><input type="number" id="x7" value="0"></td>
            <td><input type="number" id="x8" value="0"></td>
            <td><input type="number" id="x9" value="0"></td>
        </tr>
        <tr style="background-color: #c0ffff;">
            <td>输入</td>
            <td colspan="9"><input type="number" id="in1"></td>
        </tr>
        <tr style="background-color: #c0ffff;">
            <td colspan="10"><input type="button" value="计算" onclick="计算()"></td>
        </tr>
        <tr>
            <td>输出</td>
            <td id="out1"></td>
            <td id="out2"></td>
            <td id="out3"></td>
            <td id="out4"></td>
            <td id="out5"></td>
            <td id="out6"></td>
            <td id="out7"></td>
            <td id="out8"></td>
            <td id="out9"></td>
        </tr>
    </table>
</body>
<script>
    //计算
    function 计算(){
        var max=new Array(10);
        var x=new Array(10);
        var out=new Array(10);
        var in1=parseFloat(document.getElementById("in1").value);

        max[1]=parseFloat(max1.value);
        max[2]=parseFloat(max2.value);
        max[3]=parseFloat(max3.value);
        max[4]=parseFloat(max4.value);
        max[5]=parseFloat(max5.value);
        max[6]=parseFloat(max6.value);
        max[7]=parseFloat(max7.value);
        max[8]=parseFloat(max8.value);
        max[9]=parseFloat(max9.value);
        
        x[1]=parseFloat(document.getElementById("x1").value);
        x[2]=parseFloat(document.getElementById("x2").value);
        x[3]=parseFloat(document.getElementById("x3").value);
        x[4]=parseFloat(document.getElementById("x4").value);
        x[5]=parseFloat(document.getElementById("x5").value);
        x[6]=parseFloat(document.getElementById("x6").value);
        x[7]=parseFloat(document.getElementById("x7").value);
        x[8]=parseFloat(document.getElementById("x8").value);
        x[9]=parseFloat(document.getElementById("x9").value);
        if(x[5]<=max[5]){
            if(x[5]+Math.round(in1*0.3)<=max[5]){
                x[5]+=Math.round(in1*0.3);
                in1-=Math.round(in1*0.3);
            }else{
                x[5]+=max[5]-x[5];
                in1-=max[5]-x[5];
            }
        }
        var temp0=in1;
        var temp99=in1;
        for(;temp0>0;){
            if(temp99<=0){break;}
            for(var i=1;i<10;i++){
                if(temp0>0){
                    if(x[i]<max[i]){
                        x[i]++;
                        temp0--;
                    }
                }else{break;}
            }
            temp99--;
        }
        for(var i=1;i<10;i++){
            if(x[i]>=max[i]){x[i]="满"}
        }
        document.getElementById("out1").innerHTML=x[1];
        document.getElementById("out2").innerHTML=x[2];
        document.getElementById("out3").innerHTML=x[3];
        document.getElementById("out4").innerHTML=x[4];
        document.getElementById("out5").innerHTML=x[5];
        document.getElementById("out6").innerHTML=x[6];
        document.getElementById("out7").innerHTML=x[7];
        document.getElementById("out8").innerHTML=x[8];
        document.getElementById("out9").innerHTML=x[9];
        setTimeout(()=>{if(temp0>0){alert("溢出"+temp0);};}, 100);
    }
</script>
<style>
    *{text-align:center;font-size:2.4vw;}
    td{border: 1px solid;width: 10%;}
    tr{border: 1px solid;}
    input{width: 90%;}
    table{border: 1px solid;width:96%;margin:0 auto;}
</style>